{if !$smarty.get.add_more}
	{if $smarty.get.all_images}
		{*ext->get_binary_list id=0 assign="file_list" type="file"*}
		{ext->get_binary_list_by_page id=0 page=$smarty.get.page items_per_page=13 type="file" assign="file_list"}
	{else}
		{*ext->get_binary_list id=$smarty.get.parent assign="file_list" type="file"*}
		{ext->get_binary_list_by_page id=$smarty.get.parent page=$smarty.get.page items_per_page=13 type="file" assign="file_list"}
	{/if}
	{assign var="file_list_count" value=$file_list.count}
	{assign var="file_list" value=$file_list.list}
	{ext->paging items_per_page=13 page=$smarty.get.page elements=$file_list_count assign="page_data"}
	{ext->countArray array=$file_list assign="counter"}
{/if}
<html>
{include file="admin/head.html"}
<body onLoad="window.focus();" style="margin: 0; padding: 0; background: #EDF0F2;">
{if $smarty.get.mode != "infield"}
<script language="javascript" type="text/javascript" src="_tvs_system_core_/mce_3.5.8/tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="_tvs_system_core_/mce_3.5.8/plugins/file/js/functions.js"></script>
{/if}
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td height="35" valign="bottom">
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#DBE1E5">
			<tr>
				{if $smarty.get.parent}
				<td {if !$smarty.get.all_images && !$smarty.get.add_more}bgcolor="#25404E"{/if} height="25" width="1"  style="padding:0px 10px 0px 10px "><nobr><a href="index.php?admin=1&insfil=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}" target="_self" class="{if !$smarty.get.all_images && !$smarty.get.add_more}white{else}black{/if}NoUnderline"  title="{$smarty.get.tpl_parent_name|stripslashes|escape:"html"}">{$smarty.get.tpl_parent_name|stripslashes|truncate:"30":"...":true}  - {t t='failai'}</a></td>	
				<td width="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				{/if}
				<td height="25" width="1" style="padding:0px 10px 0px 10px " {if $smarty.get.all_images}bgcolor="#25404E"{/if}><nobr><a href="index.php?admin=1&insfil=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1" target="_self" class="{if $smarty.get.all_images}white{else}black{/if}NoUnderline">{t t='Visi svetainėje esantys failai'}</a></td>	
				<td width="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td height="25" width="1" style="padding:0px 10px 0px 10px " {if $smarty.get.add_more}bgcolor="#25404E"{/if}><nobr><a href="index.php?admin=1&insfil=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&add_more=1" target="_self" class="{if $smarty.get.add_more}white{else}black{/if}NoUnderline">{t t='Įkrauti daugiau failų'}</a></td>	
				<td width="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
		</table>
		</td>		
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="5" bgcolor="#25404E"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
{if !$smarty.get.add_more}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td height="370" bgcolor="#FFFFFF" valign="top">
		<!-- *  -->
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="345" valign="top">
				<table width="100%" cellpadding="5" cellspacing="0">
        {foreach from=$file_list item="el"}
					{ext->get_binary_data id=$el.id assign="binary_data"}
						<tr>
							<td width="300"><strong>{$el.name|truncate:40:"..."}</strong></td>
							<td width="1"><nobr>{$el.save_date}</nobr></td>
							<td>{if $binary_data.info.size}{math equation="x/1024" x=$binary_data.info.size format="%.2f"}{else}0{/if}kb</td>
							<td align="right">
								<table cellpadding="0" cellspacing="0">
									<tr>
										{if $smarty.get.mode == "infield"}
										<td width="5"><a href="#" target="_self" onClick="top.opener.window.document.forms['form{$smarty.get.parent}'].x_{$smarty.get.field}.value = '{$el.id}';  top.opener.window.InsertFromGallery(1, '{$smarty.get.field}'); window.close();" title="{t t="Įterpti failą"}"><img src="_tvs_system_core_/design/img/gallery/01_insert.gif"></a></td>
										{else}
										<td width="5"><a href="#" target="_self" onClick="insertAction('<a href=\'{ext->get_path}/get.php?f.{$el.id}\'>'); window.close();" title="{t t="Įterpti failą kaip nuorodą"}"><img src="_tvs_system_core_/design/img/gallery/01_insert.gif"></a></td>
										{/if}
										<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
										<td width="1" bgcolor="#E5E5E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
										<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
										<td width="5"><a onClick="if (confirm('\nDo you want\ndelete this file?')) location.href='{$_http_path}/index.php?insfil=1&admin=1&mod=files&act=del&id={$el.id}&parent={$smarty.get.parent}&fld={$smarty.get.field}&referer={ext->get_referer}';" href="#"  title="{t t="Ištrinti failą iš sistemos"}"><img src="_tvs_system_core_/design/img/gallery/05_delete.gif"></a></td>
									</tr>
								</table>
							</td>
						</tr>
				{/foreach}
				</table>


				{if $counter==0}
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td height="340" align="center">
						{t t='Šis punktas neturi failų. Įkraukite juos arba išsirinkite failą iš visų svetainėje esančių failų.'}
						<br>
						<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1" target="_self" class="{if $smarty.get.all_images}white{else}black{/if}NoUnderline"><strong>{t t="Visi svetainėje esantys failai"}</strong></a>
						</td>		
					</tr>
				</table>
				{/if}
				
				</td>		
			</tr>
		</table>
		<!-- /*  -->

		<!-- * paging  -->
		<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td align="center" height="15">
				{if $page_data.totalelements!=0}
					{assign var="pages_per_page" value=15}
					{t t='Puslapiai'} ({$page_data.current_page.number} {t t='iš'} {$page_data.totalpages}):
					{if $page_data.current_page.number > $pages_per_page}<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.current_page.number-$pages_per_page}{if $smarty.get.mode == "infield"}&mode=infield{/if}">...</a>{/if}
					{if $page_data.previous_page.number}<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.previous_page.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">&lt;</a>{/if}
					{foreach from=$page_data.pages item="el"}
						{if ((($page_data.current_page.number < $pages_per_page/2) && ($el.number < $pages_per_page)) || ($el.number >= $page_data.current_page.number-$pages_per_page/2) && ($el.number-$page_data.current_page.number < $pages_per_page/2))}
							{if $page_data.current_page.number!=$el.number}
								<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}{if $smarty.get.all_images}&all_images=1{/if}&page={$el.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">{$el.number}</a>
							{else}
								<strong style="color:#B70000">{$el.number}</strong>
							{/if}
						{/if}
					{/foreach}
					{if $page_data.next_page.number}<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}{if $smarty.get.all_images}&all_images=1{/if}&page={$page_data.next_page.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">&gt;</a>{/if}				
					{if $page_data.totalpages - $page_data.current_page.number > 15}<a href="index.php?admin=1&insfil=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.current_page.number+$pages_per_page}{if $smarty.get.mode == "infield"}&mode=infield{/if}">...</a>{/if}
				{/if}
				</td>		
			</tr>
		</table>
		<!-- /* paging  -->
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<form action="index.php" method="post" enctype="multipart/form-data">
<input name="admin" type="hidden" value="1">
<input name="insfil" type="hidden" value="1">
<input name="mod" type="hidden" value="files">
<input name="act" type="hidden" value="add">
<input name="parent" type="hidden" value="{$smarty.get.parent}">
<input name="referer" type="hidden" value="{ext->get_referer}">
<input type="hidden" name="all_images" value="{$smarty.get.all_images}">

<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
  <td width="15">&nbsp;</td>
		<td>
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="1"><nobr>{t t='Failo pavadinimas'}:</td>
				<td width="10">&nbsp;</td>
				<td><input type="text" class="defaultInputText" name="img_name1"></td>
			</tr>
			<tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
			<tr>
				<td><nobr>{t t='Failas'}:</td>
				<td width="10">&nbsp;</td>
				<td><input type="file" class="defaultInputText" name="img_file1"></td>
			</tr>
		</table>
		</td>
		<td width="140" align="right" valign="top">
		<input type="button" onClick="submit();" class="defaultFormButton" style="height:40px" value="{t t='Įkrauti į sistemą'}">
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
</form>
{else}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			<td height="380" bgcolor="#FFFFFF" valign="top">
				<form action="index.php" method="post" enctype="multipart/form-data">
				<input name="admin" type="hidden" value="1">
				<input name="insfil" type="hidden" value="1">
				<input name="mod" type="hidden" value="files">
				<input name="act" type="hidden" value="add">
				<input name="parent" type="hidden" value="{$smarty.get.parent}">
				<input name="referer" type="hidden" value="{ext->get_referer}">
				<input type="hidden" name="add_more" value="1">
				
				<br />
      <div style="height: 370px; overflow: auto;">
        <table width="100%" cellpadding="0" cellspacing="0">
					<tr>
            <td rowspan="2" style="width: 1px; padding: 10px;"><span style="font-size: 18px;">01</span></td>
						<td width="1">{t t='Pavadinimas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="text" class="defaultInputText" name="img_name01" /></td>
					</tr>
					<tr>
						<td><nobr>{t t='Failas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="file" class="defaultInputText" name="img_file01" /></td>
					</tr>
				</table>
				{section name=celes start=2 loop=10 step=1}
				<br />
				<table width="100%" cellpadding="0" cellspacing="0" style="border-top: 1px solid #e5e5e5;">
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
					<tr>
            <td rowspan="2" style="width: 1px; padding: 10px;"><span style="font-size: 18px;">0{$smarty.section.celes.index}</span></td>
						<td width="1">{t t='Pavadinimas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="text" class="defaultInputText" name="img_name0{$smarty.section.celes.index}" /></td>
					</tr>
					<tr>
						<td><nobr>{t t='Failas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="file" class="defaultInputText" name="img_file0{$smarty.section.celes.index}" /></td>
					</tr>
				</table>
				{/section}
				</div>
				<br />
				
			</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td width="140" align="right">
		<input type="button" onClick="submit();" class="defaultFormButton" style="height:40px" value="{t t='Įkrauti į sistemą'}">
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
</form>
{/if}
</div>
</body>
</html>
